package ysm.controller.admin;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import ysm.entity.News;
import ysm.service.NewsService;

@RestController
@RequestMapping("/public")
public class NewsController {

	@Autowired
	private NewsService newsService;
	
	@RequestMapping("/loadAllNews")
	public List loadAllNews() {
		return newsService.loadAllNews();
	}
	
	@RequestMapping("/selectNewsByPrimaryKey")
	News selectByPrimaryKey(Integer id) {
		return newsService.selectByPrimaryKey(id);
	}
	
	@RequestMapping("/insertNews")
	public void insert(News record) {
		record.setAccess("0");
		newsService.insert(record);
	}
	
	@RequestMapping("/updateNewsByPrimaryKey")
	public void updateByPrimaryKey(News record) {
		newsService.updateByPrimaryKey(record);
	}
	
}
